package nf.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConnHelper {
    private static final String URL = "jdbc:mysql://localhost:3306/oa?serverTimezone=UTC";
    private static final String USUR_NAME = "root";
    private static final String PASSWORD = "123456";

    public static Connection getConnection(){
        Connection conn = null;
        try{
            Class.forName("com.mysql.cj.jdbc.Driver");
        }catch(ClassNotFoundException e){
            System.out.println("找不到类："+e.getMessage());
        }
        try {
            conn = DriverManager.getConnection(URL,USUR_NAME,PASSWORD);
            return conn;
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        return null;
    }
}
